<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="txt">
<input type="button" id="btn" value="点我">
<script>
    function fun(data){
        var data = JSON.parse(data);
        console.log(data);
    }

    function MyAajx(url,username,callback){
        var script = document.createElement('script');
        script.src = 'http://192.168.1.117/ajax/jsonp/weather.php?callback=fun&c='+username;
        script.type = 'text/javascript';
        document.head.appendChild(script);
    }

    var btn = document.getElementById('btn');
    btn.onclick = function(){
        MyAajx('http://localhost/ajax/jsonp/1.php?',document.getElementById('txt').value,'Fun');
    }

</script>
</body>
</html>